#include <bits/stdc++.h>
using namespace std;

struct TreeNode {
	int val;
	TreeNode *left;
	TreeNode *right;
	TreeNode() : val(0), left(nullptr), right(nullptr) {}
	TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
	TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};

class Solution {
public:
	int max_depth = INT_MIN;
	int result_val;
	void getVal(TreeNode* root,int depth){
		if(root->left==NULL&& root->right==NULL){
			if(depth>max_depth){
				max_depth=depth;
				result_val = root->val;
			}
			return;
		}
		// 向左递归
		if(root->left){
			getVal(root->left,depth+1);
		}
		if(root->right){
			getVal(root->right,depth+1);
		}
		return;
	}
	int findBottomLeftValue(TreeNode* root) {
		if(root==NULL){
			return 0;
		}
		getVal(root,0);
		return result_val;
	}
};


int main(){
	
	return 0;
}
